﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.SlaughterCommand;
using RBAC.MaHaiBo.Entity.Traceability;
using RBAC.MaHaiBo.Service.TraceabilityService;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.SlaughterHandler
{
    public class GetSlaughterCommandHandler : IRequestHandler<GetSlaughterCommand, List<Slaughter>>
    {
        /// <summary>
        /// 屠宰服务层
        /// </summary>
        ISlaughterService service;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="service">屠宰服务层</param>
        public GetSlaughterCommandHandler(ISlaughterService service)
        {
            this.service = service;
        }

        public async Task<List<Slaughter>> Handle(GetSlaughterCommand request, CancellationToken cancellationToken)
        {
            return await service.GetSlaughter(request.LOT);
        }
    }
}
